const rules = {
  name: {
    required: true,
    trim: true,
    maxLength: 60,
    aliasName: '角色名'
  },
  describe: {
    maxLength: 100,
    aliasName: '角色描述'
  },
  menu_list: {
    default: ''
  }
}
module.exports = class extends think.Logic {
  postAction() {
    this.validate(rules)
  }
  putAction() {
    this.validate(rules)
  }
  __after() {
    const validateErrors = this.validateErrors
    if (validateErrors) {
      let error = []
      for(let field in validateErrors){
        error.push(validateErrors[field])
      }
      return this.fail(error.join('\n'))
    }
  }
};
